//package mysql;
//
//import java.sql.*;
//
//public class JavaSelectMysql {
//    public static void main(String[] args) {
//        try {
////            //注册驱动
//            Class.forName("com.mysql.cj.jdbc.Driver");
////            //获取连接
////            String url="jdbc:mysql://localhost:3306/wkrSpringdb";
////            String user="root";
////            String password="628511";
//            Connection connection= JavaConnectMysql.getConnection();
////            System.out.println(connection);
//            //定义sql
//            String sql ="select * from student";
//            //获取执行sql的对象
//            Statement statement=connection.createStatement();
//            //执行
//            ResultSet resultSet = statement.executeQuery(sql);
////            System.out.println(resultSet);
//            //处理结果
////            resultSet.next();
////            System.out.println(resultSet.getString("sno"));
////            System.out.println(resultSet.getString("sname"));
////            System.out.println(resultSet.getString("sex"));
////            System.out.println(resultSet.getInt("age"));
////            System.out.println(resultSet.getString("address"));
//            while (resultSet.next()){
//              System.out.print(resultSet.getString("sno")+",");
//              System.out.print(resultSet.getString("sname")+",");
//              System.out.print(resultSet.getString("sex")+",");
//              System.out.print(resultSet.getInt("age")+",");
//              System.out.println(resultSet.getString("address"));
//        }
//            //释放资源
//            resultSet.close();
//            statement.close();
//            connection.close();
//
//        } catch (SQLException | ClassNotFoundException e) {
//            e.printStackTrace();
//        }
//    }
//}
